package com.lagouedu.dao;

import com.lagouedu.pojo.LagouAuthCode;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

public interface CodeDao extends JpaRepository<LagouAuthCode,Long> {

    @Query(value = "select id from lagou_auth_code where email =:email and code =:code and now() < expiretime", nativeQuery = true)
    Long validate(@Param("email") String email,@Param("code") String code);
}
